<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>010.0015.p03.练习回调</title>
    <script>

      // window.onload = function(){
      //   console.log('js执行完成 , window context 退出');
      // }
    </script>
</head>
<body>
    <div>
        <div id="showRespDataId"></div>
        <hr><br><hr>
        <div id="showAllNet"></div>
    </div>
</body>
<script>
    function interval(callback , delay){
        var id = undefined
        // id = setInterval(function(){
        //     // return callback(id)
        //     callback(id)
        // },delay)

        id = setInterval( ()=> callback(id) ,delay)  // 与上述一致。这就是js代码写得少！


        // id = setInterval( callback ,delay)  // 这种，不知道入参是谁


        console.log('print interval id : ' , id );
    }

    interval(function(id){
        console.log(id);
    } , 1000 )

</script>
</html>